package com.jisf.driver.entity.po;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.jisf.driver.utils.DateUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

/**
 * @Classname DrivingSchoolLog
 * @Description TODO
 * @Date 2022/5/19 18:24
 * @Created by jisf：【429627912@qq.com】
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@ToString
@Document(indexName = "driving_school_log", type = "_doc", shards = 1, replicas = 3)
public class DrivingSchoolLog {

    public DrivingSchoolLog(String name, String msg, boolean status) {
        this.name = name;
        this.msg = msg;
        this.date = DateUtil.EsYearToSecond.format(new Date());
        this.status = status;
    }

    /**
     * 唯一标识
     */
    @Id
    private Long id;

    /**
     * 操作者名称
     */
    @Field(type = FieldType.Text)
    private String name;

    /**
     * 操作内容
     */
    @Field(type = FieldType.Text)
    private String msg;

    /**
     * 操作时间
     */
    @Field(type = FieldType.Date)
    private String date;

    /**
     * 是否操作成功
     */
    @Field(type = FieldType.Boolean)
    private boolean status;

}
